package service

import (
	"github.com/kevin186/casbin/lib"
	"github.com/kevin186/casbin/models"
)

func DeleteRouter(routerName, routerMethod string) (*models.Router, error) {
	var router *models.Router
	if err := lib.DB.Where("r_name = ? and r_method = ?", routerName, routerMethod).Delete(&router).Error; err != nil {
		return nil, err
	}
	router.RouterName = routerName
	router.RouterMethod = routerMethod
	return router, nil
}
